home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / doom / quake2.zip / QJOE19.ZIP / CLIENT.QC < prev    next >
Text File  |  1996-08-17  |  34KB  |  1,455 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float   modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float   intermission_running;
  21. float   intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35. // remove items
  36.     self.items = self.items - (self.items & 
  37.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  38.     
  39. // cap super health
  40.     if (self.health > 100)
  41.         self.health = 100;
  42.     if (self.health < 50)
  43.         self.health = 50;
  44.     self.ishead = 0;
  45.     parm1 = self.items;
  46.     parm2 = self.health;
  47.     parm3 = self.armorvalue;
  48.     if (self.ammo_shells < 25)
  49.         parm4 = 25;
  50.     else
  51.         parm4 = self.ammo_shells;
  52.     parm5 = self.ammo_nails;
  53.     parm6 = self.ammo_rockets;
  54.     parm7 = self.ammo_cells;
  55.     parm8 = self.weapon;
  56.     parm9 = self.armortype * 100;
  57. };
  58.  
  59. void() SetNewParms =
  60. {
  61.     parm1 = IT_SHOTGUN | IT_AXE | QJ_TEETH;
  62.     parm2 = 100;
  63.     parm3 = 0;
  64.     parm4 = 25;
  65.     parm5 = 0;
  66.     parm6 = 0;
  67.     parm6 = 0;
  68.     parm8 = 1;
  69.     parm9 = 0;
  70. };
  71.  
  72. void() DecodeLevelParms =
  73. {
  74.     if (serverflags)
  75.     {
  76.         if (world.model == "maps/start.bsp")
  77.             SetNewParms ();         // take away all stuff on starting new episode
  78.     }
  79.     
  80.     self.items = parm1;
  81.     self.health = parm2;
  82.     self.armorvalue = parm3;
  83.     self.ammo_shells = parm4;
  84.     self.ammo_nails = parm5;
  85.     self.ammo_rockets = parm6;
  86.     self.ammo_cells = parm7;
  87.     self.weapon = parm8;
  88.     self.armortype = parm9 * 0.01;
  89. };
  90.  
  91. /*
  92. ============
  93. FindIntermission
  94.  
  95. Returns the entity to view from
  96. ============
  97. */
  98. entity() FindIntermission =
  99. {
  100.     local   entity spot;
  101.     local   float cyc;
  102.  
  103. // look for info_intermission first
  104.     spot = find (world, classname, "info_intermission");
  105.     if (spot)
  106.     {       // pick a random one
  107.         cyc = random() * 4;
  108.         while (cyc > 1)
  109.         {
  110.             spot = find (spot, classname, "info_intermission");
  111.             if (!spot)
  112.                 spot = find (spot, classname, "info_intermission");
  113.             cyc = cyc - 1;
  114.         }
  115.         return spot;
  116.     }
  117.  
  118. // then look for the start position
  119.     spot = find (world, classname, "info_player_start");
  120.     if (spot)
  121.         return spot;
  122.     
  123. // testinfo_player_start is only found in regioned levels
  124.     spot = find (world, classname, "testplayerstart");
  125.     if (spot)
  126.         return spot;
  127.     
  128.     objerror ("FindIntermission: no spot");
  129. };
  130.  
  131.  
  132. string nextmap;
  133. void() GotoNextMap =
  134. {
  135.     if (cvar("samelevel"))  // if samelevel is set, stay on same level
  136.         changelevel (mapname);
  137.     else
  138.         changelevel (nextmap);
  139. };
  140.  
  141.  
  142. void() ExitIntermission =
  143. {
  144. // skip any text in deathmatch
  145.     if (deathmatch)
  146.     {
  147.         GotoNextMap ();
  148.         return;
  149.     }
  150.     
  151.     intermission_exittime = time + 1;
  152.     intermission_running = intermission_running + 1;
  153.  
  154. //
  155. // run some text if at the end of an episode
  156. //
  157.     if (intermission_running == 2)
  158.     {
  159.         if (world.model == "maps/e1m7.bsp")
  160.         {
  161.             WriteByte (MSG_ALL, SVC_CDTRACK);
  162.             WriteByte (MSG_ALL, 2);
  163.             WriteByte (MSG_ALL, 3);
  164.             if (!cvar("registered"))
  165.             {
  166.                 WriteByte (MSG_ALL, SVC_FINALE);
  167.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  168.             }
  169.             else
  170.             {
  171.                 WriteByte (MSG_ALL, SVC_FINALE);
  172.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  173.             }
  174.             return;
  175.         }
  176.         else if (world.model == "maps/e2m6.bsp")
  177.         {
  178.             WriteByte (MSG_ALL, SVC_CDTRACK);
  179.             WriteByte (MSG_ALL, 2);
  180.             WriteByte (MSG_ALL, 3);
  181.  
  182.             WriteByte (MSG_ALL, SVC_FINALE);
  183.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  184.             return;
  185.         }
  186.         else if (world.model == "maps/e3m6.bsp")
  187.         {
  188.             WriteByte (MSG_ALL, SVC_CDTRACK);
  189.             WriteByte (MSG_ALL, 2);
  190.             WriteByte (MSG_ALL, 3);
  191.  
  192.             WriteByte (MSG_ALL, SVC_FINALE);
  193.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  194.             return;
  195.         }
  196.         else if (world.model == "maps/e4m7.bsp")
  197.         {
  198.             WriteByte (MSG_ALL, SVC_CDTRACK);
  199.             WriteByte (MSG_ALL, 2);
  200.             WriteByte (MSG_ALL, 3);
  201.  
  202.             WriteByte (MSG_ALL, SVC_FINALE);
  203.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  204.             return;
  205.         }
  206.  
  207.         GotoNextMap();
  208.     }
  209.     
  210.     if (intermission_running == 3)
  211.     {
  212.         if (!cvar("registered"))
  213.         {       // shareware episode has been completed, go to sell screen
  214.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  215.             return;
  216.         }
  217.         
  218.         if ( (serverflags&15) == 15)
  219.         {
  220.             WriteByte (MSG_ALL, SVC_FINALE);
  221.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  222.             return;
  223.         }
  224.         
  225.     }
  226.  
  227.     GotoNextMap();
  228. };
  229.  
  230. /*
  231. ============
  232. IntermissionThink
  233.  
  234. When the player presses attack or jump, change to the next level
  235. ============
  236. */
  237. void() IntermissionThink =
  238. {
  239.     if (time < intermission_exittime)
  240.         return;
  241.  
  242.     if (!self.button0 && !self.button1 && !self.button2)
  243.         return;
  244.     
  245.     ExitIntermission ();
  246. };
  247.  
  248. void() execute_changelevel =
  249. {
  250.     local entity    pos;
  251.  
  252.     intermission_running = 1;
  253.     
  254. // enforce a wait time before allowing changelevel
  255.     if (deathmatch)
  256.         intermission_exittime = time + 5;
  257.     else
  258.         intermission_exittime = time + 2;
  259.  
  260.     WriteByte (MSG_ALL, SVC_CDTRACK);
  261.     WriteByte (MSG_ALL, 3);
  262.     WriteByte (MSG_ALL, 3);
  263.     
  264.     pos = FindIntermission ();
  265.  
  266.     other = find (world, classname, "player");
  267.     while (other != world)
  268.     {
  269.         other.view_ofs = '0 0 0';
  270.         other.angles = other.v_angle = pos.mangle;
  271.         other.fixangle = TRUE;          // turn this way immediately
  272.         other.nextthink = time + 0.5;
  273.         other.takedamage = DAMAGE_NO;
  274.         other.solid = SOLID_NOT;
  275.         other.movetype = MOVETYPE_NONE;
  276.         other.modelindex = 0;
  277.         setorigin (other, pos.origin);
  278.         other = find (other, classname, "player");
  279.     }       
  280.  
  281.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  282. };
  283.  
  284.  
  285. void() changelevel_touch =
  286. {
  287.     local entity    pos;
  288.  
  289.     if (other.classname != "player")
  290.         return;
  291.  
  292.     if (cvar("noexit"))
  293.     {
  294.         T_Damage (other, self, self, 50000);
  295.         return;
  296.     }
  297.     bprint (other.netname);
  298.     bprint (" exited the level\n");
  299.     
  300.     nextmap = self.map;
  301.  
  302.     SUB_UseTargets ();
  303.  
  304.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  305.     {       // NO_INTERMISSION
  306.         GotoNextMap();
  307.         return;
  308.     }
  309.     
  310.     self.touch = SUB_Null;
  311.  
  312. // we can't move people right now, because touch functions are called
  313. // in the middle of C movement code, so set a think time to do it
  314.     self.think = execute_changelevel;
  315.     self.nextthink = time + 0.1;
  316. };
  317.  
  318. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  319. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  320. */
  321. void() trigger_changelevel =
  322. {
  323.     if (!self.map)
  324.         objerror ("chagnelevel trigger doesn't have map");
  325.     
  326.     InitTrigger ();
  327.     self.touch = changelevel_touch;
  328. };
  329.  
  330.  
  331. /*
  332. =============================================================================
  333.  
  334.                 PLAYER GAME EDGE FUNCTIONS
  335.  
  336. =============================================================================
  337. */
  338.  
  339. void() set_suicide_frame;
  340.  
  341. // called by ClientKill and DeadThink
  342. void() respawn =
  343. {
  344.     if (coop)
  345.     {
  346.         // make a copy of the dead body for appearances sake
  347.         CopyToBodyQue (self);
  348.         // get the spawn parms as they were at level start
  349.         setspawnparms (self);
  350.         // respawn              
  351.         PutClientInServer ();
  352.     }
  353.     else if (deathmatch)
  354.     {
  355.         // make a copy of the dead body for appearances sake
  356.         CopyToBodyQue (self);
  357.         // set default spawn parms
  358.         SetNewParms ();
  359.         // respawn              
  360.         PutClientInServer ();
  361.     }
  362.     else
  363.     {       // restart the entire server
  364.         localcmd ("restart\n");
  365.     }
  366. };
  367.  
  368.  
  369. /*
  370. ============
  371. ClientKill
  372.  
  373. Player entered the suicide command
  374. ============
  375. */
  376. void() ClientKill =
  377. {
  378.     bprint (self.netname);
  379.     bprint (" suicides\n");
  380.     set_suicide_frame ();
  381.     self.modelindex = modelindex_player;
  382.     self.frags = self.frags - 2;    // extra penalty
  383.     respawn ();
  384. };
  385.  
  386. float(vector v) CheckSpawnPoint =
  387. {
  388.     return FALSE;
  389. };
  390.  
  391. /*
  392. ============
  393. SelectSpawnPoint
  394.  
  395. Returns the entity to spawn at
  396. ============
  397. */
  398. entity() SelectSpawnPoint =
  399. {
  400.     local   entity spot;
  401.     
  402. // testinfo_player_start is only found in regioned levels
  403.     spot = find (world, classname, "testplayerstart");
  404.     if (spot)
  405.         return spot;
  406.         
  407. // choose a info_player_deathmatch point
  408.     if (coop)
  409.     {
  410.         lastspawn = find(lastspawn, classname, "info_player_coop");
  411.         if (lastspawn == world)
  412.             lastspawn = find (lastspawn, classname, "info_player_start");
  413.         if (lastspawn != world)
  414.             return lastspawn;
  415.     }
  416.     else if (deathmatch)
  417.     {
  418.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  419.         if (lastspawn == world)
  420.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  421.         if (lastspawn != world)
  422.             return lastspawn;
  423.     }
  424.  
  425.     if (serverflags)
  426.     {       // return with a rune to start
  427.         spot = find (world, classname, "info_player_start2");
  428.         if (spot)
  429.             return spot;
  430.     }
  431.     
  432.     spot = find (world, classname, "info_player_start");
  433.     if (!spot)
  434.         error ("PutClientInServer: no info_player_start on level");
  435.     
  436.     return spot;
  437. };
  438.  
  439. /*
  440. ===========
  441. PutClientInServer
  442.  
  443. called each time a player is spawned
  444. ============
  445. */
  446. void() DecodeLevelParms;
  447. void() PlayerDie;
  448.  
  449.  
  450. void() PutClientInServer =
  451. {
  452.     local   entity spot;
  453.  
  454.     self.classname = "player";
  455.     self.health = 100;
  456.     self.takedamage = DAMAGE_AIM;
  457.     self.solid = SOLID_SLIDEBOX;
  458.     self.movetype = MOVETYPE_WALK;
  459.     self.show_hostile = 0;
  460.     self.max_health = 100;
  461.     self.flags = FL_CLIENT;
  462.     self.air_finished = time + 12;
  463.     self.dmg = 2;                   // initial water damage
  464.     self.super_damage_finished = 0;
  465.     self.radsuit_finished = 0;
  466.     self.invisible_finished = 0;
  467.     self.invincible_finished = 0;
  468.     self.effects = 0;
  469.     self.invincible_time = 0;
  470.     //QJOE
  471.     self.ishead = 0;
  472.  
  473.     DecodeLevelParms ();
  474.     
  475.     W_SetCurrentAmmo ();
  476.  
  477.     self.attack_finished = time;
  478.     self.th_pain = player_pain;
  479.     self.th_die = PlayerDie;
  480.     
  481.     self.deadflag = DEAD_NO;
  482. // paustime is set by teleporters to keep the player from moving a while
  483.     self.pausetime = 0;
  484.     
  485.     spot = SelectSpawnPoint ();
  486.  
  487.     self.origin = spot.origin + '0 0 1';
  488.     self.angles = spot.angles;
  489.     self.fixangle = TRUE;           // turn this way immediately
  490.  
  491. // oh, this is a hack!
  492.     setmodel (self, "progs/eyes.mdl");
  493.     modelindex_eyes = self.modelindex;
  494.  
  495.     setmodel (self, "progs/player.mdl");
  496.     modelindex_player = self.modelindex;
  497.  
  498.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  499.     
  500.     self.view_ofs = '0 0 22';
  501.  
  502.     player_stand1 ();
  503.     
  504.     if (deathmatch || coop)
  505.     {
  506.         makevectors(self.angles);
  507.         spawn_tfog (self.origin + v_forward*20);
  508.     }
  509.  
  510.     spawn_tdeath (self.origin, self);
  511. };
  512.  
  513.  
  514. /*
  515. =============================================================================
  516.  
  517.                 QUAKED FUNCTIONS
  518.  
  519. =============================================================================
  520. */
  521.  
  522.  
  523. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  524. The normal starting point for a level.
  525. */
  526. void() info_player_start =
  527. {
  528. };
  529.  
  530.  
  531. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  532. Only used on start map for the return point from an episode.
  533. */
  534. void() info_player_start2 =
  535. {
  536. };
  537.  
  538.  
  539. /*
  540. saved out by quaked in region mode
  541. */
  542. void() testplayerstart =
  543. {
  544. };
  545.  
  546. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  547. potential spawning position for deathmatch games
  548. */
  549. void() info_player_deathmatch =
  550. {
  551. };
  552.  
  553. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  554. potential spawning position for coop games
  555. */
  556. void() info_player_coop =
  557. {
  558. };
  559.  
  560. /*
  561. ===============================================================================
  562.  
  563. RULES
  564.  
  565. ===============================================================================
  566. */
  567.  
  568. void(entity c) PrintClientScore =
  569. {
  570.     if (c.frags > -10 && c.frags < 0)
  571.         bprint (" ");
  572.     else if (c.frags >= 0)
  573.     {
  574.         if (c.frags < 100)
  575.             bprint (" ");
  576.         if (c.frags < 10)
  577.             bprint (" ");
  578.     }
  579.     bprint (ftos(c.frags));
  580.     bprint (" ");
  581.     bprint (c.netname);
  582.     bprint ("\n");
  583. };
  584.  
  585. void() DumpScore =
  586. {
  587.     local entity    e, sort, walk;
  588.  
  589.     if (world.chain)
  590.         error ("DumpScore: world.chain is set");
  591.  
  592. // build a sorted lis
  593.     e = find(world, classname, "player");
  594.     sort = world;
  595.     while (e)
  596.     {
  597.         if (!sort)
  598.         {
  599.             sort = e;
  600.             e.chain = world;
  601.         }
  602.         else
  603.         {
  604.             if (e.frags > sort.frags)
  605.             {
  606.                 e.chain = sort;
  607.                 sort = e;
  608.             }
  609.             else
  610.             {
  611.                 walk = sort;
  612.                 do
  613.                 {
  614.                     if (!walk.chain)
  615.                     {
  616.                         e.chain = world;
  617.                         walk.chain = e;
  618.                     }
  619.                     else if (walk.chain.frags < e.frags)
  620.                     {
  621.                         e.chain = walk.chain;
  622.                         walk.chain = e;
  623.                     }
  624.                     else
  625.                         walk = walk.chain;
  626.                 } while (walk.chain != e);
  627.             }
  628.         }
  629.         
  630.         e = find(e, classname, "player");
  631.     }
  632.  
  633. // print the list
  634.     
  635.     bprint ("\n");  
  636.     while (sort)
  637.     {
  638.         PrintClientScore (sort);
  639.         sort = sort.chain;
  640.     }
  641.     bprint ("\n");
  642. };
  643.  
  644. /*
  645. go to the next level for deathmatch
  646. */
  647. void() NextLevel =
  648. {
  649.     local entity o;
  650.  
  651. // find a trigger changelevel
  652.     o = find(world, classname, "trigger_changelevel");
  653.     if (!o || mapname == "start")
  654.     {       // go back to same map if no trigger_changelevel
  655.         o = spawn();
  656.         o.map = mapname;
  657.     }
  658.  
  659.     nextmap = o.map;
  660.     
  661.     if (o.nextthink < time)
  662.     {
  663.         o.think = execute_changelevel;
  664.         o.nextthink = time + 0.1;
  665.     }
  666. };
  667.  
  668. /*
  669. ============
  670. CheckRules
  671.  
  672. Exit deathmatch games upon conditions
  673. ============
  674. */
  675. void() CheckRules =
  676. {
  677.     local   float           timelimit;
  678.     local   float           fraglimit;
  679.     
  680.     if (gameover)   // someone else quit the game already
  681.         return;
  682.         
  683.     timelimit = cvar("timelimit") * 60;
  684.     fraglimit = cvar("fraglimit");
  685.     
  686.     if (timelimit && time >= timelimit)
  687.     {
  688. NextLevel ();
  689. /*
  690.         gameover = TRUE;
  691.         bprint ("\n\n\n==============================\n");
  692.         bprint ("game exited after ");
  693.         bprint (ftos(timelimit/60));
  694.         bprint (" minutes\n");
  695.         DumpScore ();
  696.         localcmd ("killserver\n");
  697. */
  698.         return;
  699.     }
  700.     
  701.     if (fraglimit && self.frags >= fraglimit)
  702.     {
  703. NextLevel ();
  704. /*
  705.         gameover = TRUE;
  706.         bprint ("\n\n\n==============================\n");
  707.         bprint ("game exited after ");
  708.         bprint (ftos(self.frags));
  709.         bprint (" frags\n");
  710.         DumpScore ();
  711.         localcmd ("killserver\n");
  712. */
  713.         return;
  714.     }       
  715. };
  716.  
  717. //============================================================================
  718.  
  719. void() PlayerDeathThink =
  720. {
  721.     local entity    old_self;
  722.     local float             forward;
  723.  
  724.     if ((self.flags & FL_ONGROUND))
  725.     {
  726.         forward = vlen (self.velocity);
  727.         forward = forward - 20;
  728.         if (forward <= 0)
  729.             self.velocity = '0 0 0';
  730.         else    
  731.             self.velocity = forward * normalize(self.velocity);
  732.     }
  733.  
  734. // wait for all buttons released
  735.     if (self.deadflag == DEAD_DEAD)
  736.     {
  737.         if (self.button2 || self.button1 || self.button0)
  738.             return;
  739.         self.deadflag = DEAD_RESPAWNABLE;
  740.         return;
  741.     }
  742.  
  743. // wait for any button down
  744.     if (!self.button2 && !self.button1 && !self.button0)
  745.         return;
  746.  
  747.     self.button0 = 0;
  748.     self.button1 = 0;
  749.     self.button2 = 0;
  750.     respawn();
  751. };
  752.  
  753.  
  754. void() PlayerJump =
  755. {
  756.     local vector start, end;
  757.     
  758.     if (self.flags & FL_WATERJUMP)
  759.         return;
  760.     
  761.     if (self.waterlevel >= 2)
  762.     {
  763.         if (self.watertype == CONTENT_WATER)
  764.             self.velocity_z = 100;
  765.         else if (self.watertype == CONTENT_SLIME)
  766.             self.velocity_z = 80;
  767.         else
  768.             self.velocity_z = 50;
  769.  
  770. // play swiming sound
  771.         if (self.swim_flag < time)
  772.         {
  773.             self.swim_flag = time + 1;
  774.             if (random() < 0.5)
  775.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  776.             else
  777.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  778.         }
  779.  
  780.         return;
  781.     }
  782.  
  783.     if (!(self.flags & FL_ONGROUND))
  784.         return;
  785.  
  786.     if ( !(self.flags & FL_JUMPRELEASED) )
  787.         return;         // don't pogo stick
  788.  
  789.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  790.  
  791.     self.flags = self.flags - FL_ONGROUND;  // don't stairwalk
  792.     
  793.     self.button2 = 0;
  794. // player jumping sound
  795.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  796.     self.velocity_z = self.velocity_z + 270;
  797. };
  798.  
  799.  
  800. /*
  801. ===========
  802. WaterMove
  803.  
  804. ============
  805. */
  806. .float  dmgtime;
  807.  
  808. void() WaterMove =
  809. {
  810. //dprint (ftos(self.waterlevel));
  811.     if (self.movetype == MOVETYPE_NOCLIP)
  812.         return;
  813.     if (self.health < 0)
  814.         return;
  815.  
  816.     if (self.waterlevel != 3)
  817.     {
  818.         if (self.air_finished < time)
  819.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  820.         else if (self.air_finished < time + 9)
  821.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  822.         self.air_finished = time + 12;
  823.         self.dmg = 2;
  824.     }
  825.     else if (self.air_finished < time)
  826.     {       // drown!
  827.         if (self.pain_finished < time)
  828.         {
  829.             self.dmg = self.dmg + 2;
  830.             if (self.dmg > 15)
  831.                 self.dmg = 10;
  832.             T_Damage (self, world, world, self.dmg);
  833.             self.pain_finished = time + 1;
  834.         }
  835.     }
  836.     
  837.     if (!self.waterlevel)
  838.     {
  839.         if (self.flags & FL_INWATER)
  840.         {       
  841.             // play leave water sound
  842.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  843.             self.flags = self.flags - FL_INWATER;
  844.         }
  845.         return;
  846.     }
  847.  
  848.     if (self.watertype == CONTENT_LAVA)
  849.     {       // do damage
  850.         if (self.dmgtime < time)
  851.         {
  852.             if (self.radsuit_finished > time)
  853.                 self.dmgtime = time + 1;
  854.             else
  855.                 self.dmgtime = time + 0.2;
  856.  
  857.             T_Damage (self, world, world, 10*self.waterlevel);
  858.         }
  859.     }
  860.     else if (self.watertype == CONTENT_SLIME)
  861.     {       // do damage
  862.         if (self.dmgtime < time && self.radsuit_finished < time)
  863.         {
  864.             self.dmgtime = time + 1;
  865.             T_Damage (self, world, world, 4*self.waterlevel);
  866.         }
  867.     }
  868.     
  869.     if ( !(self.flags & FL_INWATER) )
  870.     {       
  871.  
  872. // player enter water sound
  873.  
  874.         if (self.watertype == CONTENT_LAVA)
  875.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  876.         if (self.watertype == CONTENT_WATER)
  877.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  878.         if (self.watertype == CONTENT_SLIME)
  879.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  880.  
  881.         self.flags = self.flags + FL_INWATER;
  882.         self.dmgtime = 0;
  883.     }
  884.     
  885.     if (! (self.flags & FL_WATERJUMP) )
  886.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  887. };
  888.  
  889. void() CheckWaterJump =
  890. {
  891.     local vector start, end;
  892.  
  893. // check for a jump-out-of-water
  894.     makevectors (self.angles);
  895.     start = self.origin;
  896.     start_z = start_z + 8; 
  897.     v_forward_z = 0;
  898.     normalize(v_forward);
  899.     end = start + v_forward*24;
  900.     traceline (start, end, TRUE, self);
  901.     if (trace_fraction < 1)
  902.     {       // solid at waist
  903.         start_z = start_z + self.maxs_z - 8;
  904.         end = start + v_forward*24;
  905.         self.movedir = trace_plane_normal * -50;
  906.         traceline (start, end, TRUE, self);
  907.         if (trace_fraction == 1)
  908.         {       // open at eye level
  909.             self.flags = self.flags | FL_WATERJUMP;
  910.             self.velocity_z = 225;
  911.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  912.             self.teleport_time = time + 2;  // safety net
  913.             return;
  914.         }
  915.     }
  916. };
  917.  
  918.  
  919. /*
  920. ================
  921. PlayerPreThink
  922.  
  923. Called every frame before physics are run
  924. ================
  925. */
  926. void() PlayerPreThink =
  927. {
  928.     local   float   mspeed, aspeed;
  929.     local   float   r;
  930.  
  931.     if (intermission_running)
  932.     {
  933.         IntermissionThink ();   // otherwise a button could be missed between
  934.         return;                                 // the think tics
  935.     }
  936.  
  937.     if (self.view_ofs == '0 0 0')
  938.         return;         // intermission or finale
  939.  
  940.     makevectors (self.v_angle);             // is this still used
  941.  
  942.     CheckRules ();
  943.     WaterMove ();
  944.  
  945.     if (self.waterlevel == 2)
  946.         CheckWaterJump ();
  947.  
  948.     if (self.deadflag >= DEAD_DEAD)
  949.     {
  950.         PlayerDeathThink ();
  951.         return;
  952.     }
  953.     
  954.     if (self.deadflag == DEAD_DYING)
  955.         return; // dying, so do nothing
  956.  
  957.     if (self.button2)
  958.     {
  959.         PlayerJump ();
  960.     }
  961.     else
  962.         self.flags = self.flags | FL_JUMPRELEASED;
  963.  
  964. // teleporters can force a non-moving pause time        
  965.     if (time < self.pausetime)
  966.         self.velocity = '0 0 0';
  967. };
  968.     
  969. /*
  970. ================
  971. CheckPowerups
  972.  
  973. Check for turning off powerups
  974. ================
  975. */
  976. void() CheckPowerups =
  977. {
  978.     if (self.health <= 0)
  979.         return;
  980.  
  981. // invisibility
  982.     if (self.invisible_finished)
  983.     {
  984. // sound and screen flash when items starts to run out
  985.         if (self.invisible_sound < time)
  986.         {
  987.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  988.             self.invisible_sound = time + ((random() * 3) + 1);
  989.         }
  990.  
  991.  
  992.         if (self.invisible_finished < time + 3)
  993.         {
  994.             if (self.invisible_time == 1)
  995.             {
  996.                 sprint (self, "Ring of Shadows magic is fading\n");
  997.                 stuffcmd (self, "bf\n");
  998.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  999.                 self.invisible_time = time + 1;
  1000.             }
  1001.             
  1002.             if (self.invisible_time < time)
  1003.             {
  1004.                 self.invisible_time = time + 1;
  1005.                 stuffcmd (self, "bf\n");
  1006.             }
  1007.         }
  1008.  
  1009.         if (self.invisible_finished < time)
  1010.         {       // just stopped
  1011.             self.items = self.items - IT_INVISIBILITY;
  1012.             self.invisible_finished = 0;
  1013.             self.invisible_time = 0;
  1014.         }
  1015.         
  1016.     // use the eyes
  1017.         self.frame = 0;
  1018.         self.modelindex = modelindex_eyes;
  1019.     }
  1020.     else
  1021.         self.modelindex = modelindex_player;    // don't use eyes
  1022.  
  1023. // invincibility
  1024.     if (self.invincible_finished)
  1025.     {
  1026. // sound and screen flash when items starts to run out
  1027.         if (self.invincible_finished < time + 3)
  1028.         {
  1029.             if (self.invincible_time == 1)
  1030.             {
  1031.                 sprint (self, "Protection is almost burned out\n");
  1032.                 stuffcmd (self, "bf\n");
  1033.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1034.                 self.invincible_time = time + 1;
  1035.             }
  1036.             
  1037.             if (self.invincible_time < time)
  1038.             {
  1039.                 self.invincible_time = time + 1;
  1040.                 stuffcmd (self, "bf\n");
  1041.             }
  1042.         }
  1043.         
  1044.         if (self.invincible_finished < time)
  1045.         {       // just stopped
  1046.             self.items = self.items - IT_INVULNERABILITY;
  1047.             self.invincible_time = 0;
  1048.             self.invincible_finished = 0;
  1049.         }
  1050.         if (self.invincible_finished > time)
  1051.             self.effects = self.effects | EF_DIMLIGHT;
  1052.         else
  1053.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1054.     }
  1055.  
  1056. // super damage
  1057.     if (self.super_damage_finished)
  1058.     {
  1059.  
  1060. // sound and screen flash when items starts to run out
  1061.  
  1062.         if (self.super_damage_finished < time + 3)
  1063.         {
  1064.             if (self.super_time == 1)
  1065.             {
  1066.                 sprint (self, "Quad Damage is wearing off\n");
  1067.                 stuffcmd (self, "bf\n");
  1068.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1069.                 self.super_time = time + 1;
  1070.             }         
  1071.             
  1072.             if (self.super_time < time)
  1073.             {
  1074.                 self.super_time = time + 1;
  1075.                 stuffcmd (self, "bf\n");
  1076.             }
  1077.         }
  1078.  
  1079.         if (self.super_damage_finished < time)
  1080.         {       // just stopped
  1081.             self.items = self.items - IT_QUAD;
  1082.             self.super_damage_finished = 0;
  1083.             self.super_time = 0;
  1084.         }
  1085.         if (self.super_damage_finished > time)
  1086.             self.effects = self.effects | EF_DIMLIGHT;
  1087.         else
  1088.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1089.     }       
  1090.  
  1091. // suit 
  1092.     if (self.radsuit_finished)
  1093.     {
  1094.         self.air_finished = time + 12;          // don't drown
  1095.  
  1096. // sound and screen flash when items starts to run out
  1097.         if (self.radsuit_finished < time + 3)
  1098.         {
  1099.             if (self.rad_time == 1)
  1100.             {
  1101.                 sprint (self, "Air supply in Biosuit expiring\n");
  1102.                 stuffcmd (self, "bf\n");
  1103.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1104.                 self.rad_time = time + 1;
  1105.             }
  1106.             
  1107.             if (self.rad_time < time)
  1108.             {
  1109.                 self.rad_time = time + 1;
  1110.                 stuffcmd (self, "bf\n");
  1111.             }
  1112.         }
  1113.  
  1114.         if (self.radsuit_finished < time)
  1115.         {       // just stopped
  1116.             self.items = self.items - IT_SUIT;
  1117.             self.rad_time = 0;
  1118.             self.radsuit_finished = 0;
  1119.         }
  1120.     }       
  1121.  
  1122. };
  1123.  
  1124.  
  1125. /*
  1126. ================
  1127. PlayerPostThink
  1128.  
  1129. Called every frame after physics are run
  1130. ================
  1131. */
  1132. void() PlayerPostThink =
  1133. {
  1134.     local   float   mspeed, aspeed;
  1135.     local   float   r;
  1136.  
  1137.     if (self.view_ofs == '0 0 0')
  1138.         return;         // intermission or finale
  1139.     if (self.deadflag)
  1140.         return;
  1141.         
  1142. // do weapon stuff
  1143.  
  1144.     W_WeaponFrame ();
  1145.  
  1146. // check to see if player landed and play landing sound 
  1147.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1148.     {
  1149.         if (self.watertype == CONTENT_WATER)
  1150.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1151.         else if (self.jump_flag < -650)
  1152.         {
  1153.             T_Damage (self, world, world, 5); 
  1154.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1155.             self.deathtype = "falling";
  1156.         }
  1157.         else
  1158.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1159.  
  1160.         self.jump_flag = 0;
  1161.     }
  1162.  
  1163.     if (!(self.flags & FL_ONGROUND))
  1164.         self.jump_flag = self.velocity_z;
  1165.  
  1166.     CheckPowerups ();
  1167. };
  1168.  
  1169.  
  1170. /*
  1171. ===========
  1172. ClientConnect
  1173.  
  1174. called when a player connects to a server
  1175. ============
  1176. */
  1177. void() ClientConnect =
  1178. {
  1179.     bprint (self.netname);
  1180.     bprint (" entered the game\n");
  1181.     
  1182. // a client connecting during an intermission can cause problems
  1183.     if (intermission_running)
  1184.         ExitIntermission ();
  1185. };
  1186.  
  1187.  
  1188. /*
  1189. ===========
  1190. ClientDisconnect
  1191.  
  1192. called when a player disconnects from a server
  1193. ============
  1194. */
  1195. void() ClientDisconnect =
  1196. {
  1197.     if (gameover)
  1198.         return;
  1199.     // if the level end trigger has been activated, just return
  1200.     // since they aren't *really* leaving
  1201.  
  1202.     // let everyone else know
  1203.     bprint (self.netname);
  1204.     bprint (" left the game with ");
  1205.     bprint (ftos(self.frags));
  1206.     bprint (" frags\n");
  1207.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1208.     set_suicide_frame ();
  1209. };
  1210.  
  1211. /*
  1212. ===========
  1213. ClientObituary
  1214.  
  1215. called when a player dies
  1216. ============
  1217. */
  1218. void(entity targ, entity attacker) ClientObituary =
  1219. {
  1220.     local   float rnum;
  1221.     local   string deathstring, deathstring2;
  1222.     rnum = random();
  1223.  
  1224.     if (targ.classname == "player")
  1225.     {
  1226.         if (attacker.classname == "teledeath")
  1227.         {
  1228.             bprint (targ.netname);
  1229.             bprint (" was telefragged by ");
  1230.             bprint (attacker.owner.netname);
  1231.             bprint ("\n");
  1232.  
  1233.             attacker.owner.frags = attacker.owner.frags + 1;
  1234.             return;
  1235.         }
  1236.  
  1237.         if (attacker.classname == "teledeath2")
  1238.         {
  1239.             bprint ("Satan's power deflects ");
  1240.             bprint (targ.netname);
  1241.             bprint ("'s telefrag\n");
  1242.  
  1243.             targ.frags = targ.frags - 1;
  1244.             return;
  1245.         }
  1246.  
  1247.         if (attacker.classname == "player")
  1248.         {
  1249.             if (targ == attacker)
  1250.             {
  1251.                 // killed self
  1252.                 attacker.frags = attacker.frags - 1;
  1253.                 bprint (targ.netname);
  1254.                 
  1255.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1256.                 {
  1257.                     bprint (" discharges into the water.\n");
  1258.                     return;
  1259.                 }
  1260.                 if (targ.weapon == 16)
  1261.                     bprint (" tries to put the pin back in\n");
  1262.                 else if (rnum)
  1263.                     bprint (" becomes bored with life\n");
  1264.                 else
  1265.                     bprint (" checks if his weapon is loaded\n");
  1266.                 return;
  1267.             }
  1268.             else
  1269.             {
  1270.                 attacker.frags = attacker.frags + 1;
  1271.  
  1272.                 rnum = attacker.weapon;
  1273.                 if (rnum == QJ_TEETH)
  1274.                 {
  1275.                     if (random() < 0.5)
  1276.                     {
  1277.                     deathstring = " was eaten by ";
  1278.                     deathstring2 = "\n";
  1279.                     }
  1280.                     else
  1281.                     deathstring = " becomes ";
  1282.                     deathstring2 = "'s latenight snack\n";
  1283.                 }
  1284.                 if (rnum == IT_AXE)
  1285.                 {
  1286.                     deathstring = " was ax-murdered by ";
  1287.                     deathstring2 = "\n";
  1288.                 }
  1289.                 if (rnum == IT_SHOTGUN)
  1290.                 {
  1291.                     deathstring = " chewed on ";
  1292.                     deathstring2 = "'s boomstick\n";
  1293.                 }
  1294.                 if (rnum == IT_SUPER_SHOTGUN)
  1295.                 {
  1296.                     deathstring = " ate 2 loads of ";
  1297.                     deathstring2 = "'s buckshot\n";
  1298.                 }
  1299.                 if (rnum == IT_NAILGUN)
  1300.                 {
  1301.                     deathstring = " was nailed by ";
  1302.                     deathstring2 = "\n";
  1303.                 }
  1304.                 if (rnum == IT_SUPER_NAILGUN)
  1305.                 {
  1306.                     deathstring = " was punctured by ";
  1307.                     deathstring2 = "\n";
  1308.                 }
  1309.                 if (rnum == IT_GRENADE_LAUNCHER)
  1310.                 {
  1311.                     deathstring = " eats ";
  1312.                     deathstring2 = "'s pineapple\n";
  1313.                     if (targ.health < -40)
  1314.                     {
  1315.                         deathstring = " was gibbed by ";
  1316.                         deathstring2 = "'s grenade\n";
  1317.                     }
  1318.                 }
  1319.                 if (rnum == IT_ROCKET_LAUNCHER)
  1320.                 {
  1321.                     deathstring = " rides ";
  1322.                     deathstring2 = "'s rocket\n";
  1323.                     if (targ.health < -40)
  1324.                     {
  1325.                         deathstring = " was gibbed by ";
  1326.                         deathstring2 = "'s rocket\n" ;
  1327.                     }
  1328.                 }
  1329.                 if (rnum == IT_LIGHTNING)
  1330.                 {
  1331.                     deathstring = " accepts ";
  1332.                     if (attacker.waterlevel > 1)
  1333.                         deathstring2 = "'s discharge\n";
  1334.                     else
  1335.                         deathstring2 = "'s shaft\n";
  1336.                 }
  1337.                 bprint (targ.netname);
  1338.                 bprint (deathstring);
  1339.                 bprint (attacker.netname);
  1340.                 bprint (deathstring2);
  1341.             }
  1342.             return;
  1343.         }
  1344.         else
  1345.         {
  1346.             targ.frags = targ.frags - 1;            // killed self
  1347.             rnum = targ.watertype;
  1348.  
  1349.             bprint (targ.netname);
  1350.             if (rnum == -3)
  1351.             {
  1352.                 if (random() < 0.5)
  1353.                     bprint (" sleeps with the fishes\n");
  1354.                 else
  1355.                     bprint (" sucks it down\n");
  1356.                 return;
  1357.             }
  1358.             else if (rnum == -4)
  1359.             {
  1360.                 if (random() < 0.5)
  1361.                     bprint (" gulped a load of slime\n");
  1362.                 else
  1363.                     bprint (" can't exist on slime alone\n");
  1364.                 return;
  1365.             }
  1366.             else if (rnum == -5)
  1367.             {
  1368.                 if (targ.health < -15)
  1369.                 {
  1370.                     bprint (" burst into flames\n");
  1371.                     return;
  1372.                 }
  1373.                 if (random() < 0.5)
  1374.                     bprint (" turned into hot slag\n");
  1375.                 else
  1376.                     bprint (" visits the Volcano God\n");
  1377.                 return;
  1378.             }
  1379.  
  1380.             if (attacker.flags & FL_MONSTER)
  1381.             {
  1382.                 if (attacker.classname == "monster_army")
  1383.                     bprint (" was shot by a Grunt\n");
  1384.                 if (attacker.classname == "monster_demon1")
  1385.                     bprint (" was eviscerated by a Fiend\n");
  1386.                 if (attacker.classname == "monster_dog")
  1387.                     bprint (" was mauled by a Rottweiler\n");
  1388.                 if (attacker.classname == "monster_dragon")
  1389.                     bprint (" was fried by a Dragon\n");
  1390.                 if (attacker.classname == "monster_enforcer")
  1391.                     bprint (" was blasted by an Enforcer\n");
  1392.                 if (attacker.classname == "monster_fish")
  1393.                     bprint (" was fed to the Rotfish\n");
  1394.                 if (attacker.classname == "monster_hell_knight")
  1395.                     bprint (" was slain by a Death Knight\n");
  1396.                 if (attacker.classname == "monster_knight")
  1397.                     bprint (" was slashed by a Knight\n");
  1398.                 if (attacker.classname == "monster_ogre")
  1399.                     bprint (" was destroyed by an Ogre\n");
  1400.                 if (attacker.classname == "monster_oldone")
  1401.                     bprint (" became one with Shub-Niggurath\n");
  1402.                 if (attacker.classname == "monster_shalrath")
  1403.                     bprint (" was exploded by a Vore\n");
  1404.                 if (attacker.classname == "monster_shambler")
  1405.                     bprint (" was smashed by a Shambler\n");
  1406.                 if (attacker.classname == "monster_tarbaby")
  1407.                     bprint (" was slimed by a Spawn\n");
  1408.                 if (attacker.classname == "monster_vomit")
  1409.                     bprint (" was vomited on by a Vomitus\n");
  1410.                 if (attacker.classname == "monster_wizard")
  1411.                     bprint (" was scragged by a Scrag\n");
  1412.                 if (attacker.classname == "monster_zombie")
  1413.                     bprint (" joins the Zombies\n");
  1414.                 if (attacker.classname == "head")
  1415.                     bprint (" was killed by a disembodied head\n");
  1416.  
  1417.                 return;
  1418.             }
  1419.             if (attacker.classname == "explo_box")
  1420.             {
  1421.                 bprint (" blew up\n");
  1422.                 return;
  1423.             }
  1424.             if (attacker.solid == SOLID_BSP && attacker != world)
  1425.             {       
  1426.                 bprint (" was squished\n");
  1427.                 return;
  1428.             }
  1429.             if (targ.deathtype == "falling")
  1430.             {
  1431.                 targ.deathtype = "";
  1432.                 bprint (" fell to his death\n");
  1433.                 return;
  1434.             }
  1435.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1436.             {
  1437.                 bprint (" was spiked\n");
  1438.                 return;
  1439.             }
  1440.             if (attacker.classname == "fireball")
  1441.             {
  1442.                 bprint (" ate a lavaball\n");
  1443.                 return;
  1444.             }
  1445.             if (attacker.classname == "trigger_changelevel")
  1446.             {
  1447.                 bprint (" tried to leave\n");
  1448.                 return;
  1449.             }
  1450.  
  1451.             bprint (" died\n");
  1452.         }
  1453.     }
  1454. };
  1455.